<?php
namespace App\Jobs;

use App\Models\SystemLog;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class OperationLogJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

// 任务可以尝试的最大次数。
public $tries = 2;

// 任务可以执行的最大秒数 (超时时间)。
public $timeout = 120;

/**
* Create a new job instance.
*
* @return void
*/
public function __construct($data)
{
//
$this->queue = 'SystemLog';
$this->data = $data;
}

private $data;

/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//
    SystemLog::create($this->data);
}
}
